import type { RouteRecordRaw } from 'vue-router';
import asyncRoutes from '@/router/modules';

const routes: RouteRecordRaw[] = [];
export function mapMenusToRoutes(userMenus: any[]): RouteRecordRaw[] {
  //
  for (const menu of userMenus) {
    if (menu.type === 2) {
      const route: any = asyncRoutes.find((route) => route.path == menu.url);
      routes.push(route);
    } else {
      mapMenusToRoutes(menu.children);
    }
  }
  return routes;
}
